package com.chen.shopping_search_service.listener;


import com.chen.shopping_common.pojo.GoodsDesc;
import com.chen.shopping_common.service.SearchService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@RocketMQMessageListener(topic = "sync_goods_queue",consumerGroup = "sync_goods_group")
public class SyncGoodsListener implements RocketMQListener<GoodsDesc> {

    @Autowired
    private SearchService service;

    @Override
    public void onMessage(GoodsDesc goodsDesc) {
        System.out.println("同步es商品");
        service.syncGoodToEs(goodsDesc);
    }
}
